<?php (!defined('IN_SYSTEM') || !defined('ADMIN_PRE')) && exit('Access Denied!');?>
{admintemplate header}
<div class="box">
 	<div class="heading">
		<h1>用户管理</h1>
		<div class="buttons">
		{if ican('userindex')}
      <a href="{url('admin.php?m=user')}">用户列表</a>
      {/if}
      {if ican('useradd')}
      <a href="{url('admin.php?m=user&f=add')}">添加用户</a>
      {/if}
      {if ican('usergroupindex')}
      <a href="{url('admin.php?m=usergroup')}">用户分组</a>
      {/if}
      {if ican('usergroupadd')}
      <a href="{url('admin.php?m=usergroup&f=add')}">添加用户组</a>
      {/if}
		</div>
	</div>

	<div class="main">

		<div class="search">
			<form name="search" method="get" action="admin.php">
			<input type="hidden" name="m" value="user" />
			<input type="hidden" name="f" value="index" />
				<fieldset>
					<legend>用户查找</legend>
						关键字：
						<input type="text" name="keyword" size="15" value="{echo urldecode($keyword)}" />
						<input type="submit" name="s" class="button" value="开始查找" />
						<input type="button" class="button" value="显示所有" onclick="window.location.href='{url admin.php?m=user}'" />
						<input type="button" class="button" value="添加用户" onclick="window.location.href='{url admin.php?m=user&f=add}'" />
				</fieldset>
			</form>
		</div>

		<form name="update" method="post" action="{url admin.php?m=user}">
			<table class="list" cellspacing="0" id="list">
				<thead>
				<tr>
					<td width="1"><input type="checkbox" class="checkbox" value="1" name="chkall" onclick="check_all(this)" /></td>
					<td width="150" class="left">用户名</td>
					<td width="190">邮箱</td>
					<td width="80" align="center">审核</td>
					<td width="100" align="center">用户组</td>
					<td width="100" align="center">注册时间/上次登录</td>
					<td width="100" align="center">登录次数</td>
					<td width="80" align="center">文章</td>
					<td width="80" align="center">操作</td>
				</tr>
				</thead>
				<tbody>
				{loop $result $row}
				<tr id="row_{$row['uid']}" {if $row['status']}class="highlight"{/if}>
					<td width="1"><input type="checkbox" name="id[]" value="{$row['uid']}" class="checkbox" /></td>
					<td class="left"><a href="{url admin.php?m=user&f=edit&id=$row[uid]}">{$row['username']}</a></td>
					<td><a href="mailto:{$row['email']}">{$row['email']}</a></td>
					<td align="center"><a href="javascript:void(0)" onclick="check_user('{$row['uid']}')" id="check_a_{$row['uid']}" title="点击改变状态">{if $row['status']} 已通过 {else} <span style="color:red">未通过</span>{/if}</a></td>
					<td align="center"><a href="{url admin.php?m=user&groupid=$row[groupid]}">{$row['groupname']}</a></td>
					<td align="center">{echo gdate('ymd-H:i',$row['regtime'])}/{echo gdate('ymd-H:i',$row['lastlogin'])}</td>
					<td align="center">{echo $row['logincount']}</td>
					<td align="center"><a href="{url admin.php?m=article&uid=$row[uid]}"><b style="color:green">{$row['artcount']}</b></a></td>
					<td align="center"><a href="{url admin.php?m=user&f=edit&id=$row[uid]}">编辑</a></td>
				</tr>
				{/loop}
				<tr>
					<td width="1"><input type="checkbox" class="checkbox" value="1" name="chkall" onclick="check_all(this)" /></td>
					<td colspan="8" class="left">{echo pager($num,$pagesize,$page,$url)}全选 
					<input type="radio" name="f" value="delete" class="radio" onclick="$('#span_move').hide()" />删除 
					<input type="radio" name="f" value="promote" class="radio" onclick="$('#span_move').show()" />更改用户组 
					<span id="span_move" style="display:none">
					<select name="groupid">
						<option value="">请选择</option>
						{php $groups=$_G['userobj']->user_group();}
						{loop $groups $group}
						<option value="{$group['gid']}" >{$group['groupname']}</option>
						{/loop}
					</select>
					</span>
					<input type="submit" class="button" value="执行操作" /></td>
				</tr>
			</tbody>	
			</table>
		</form>
	
	</div>
</div>
{admintemplate footer}